import request from '../../request/index'
const state = {
    tableData: [],
    size: 25,
    curr: 1,
}
const getters = {
    count(state) {
        console.log(state.count)
    }
}
const mutations = {
    setData(state, data) {
        console.log(data);
        state.tableData = data
    },

}
const actions = {
    async getList(store) {
        await request({
            url: "/selectList",
            method: "GET",
            params: {},
        }).then((res) => {
            store.commit('setData', res)
            return res
        }).catch(err => {
            console.log(err);
        })
    },
    async setList(store, res) {
        await request({
            url: "/filterAll",
            method: "GET",
            params: { res },
        }).then((res) => {
            console.log(res);
            store.commit('setData', res)
            return res
        }).catch(err => {
            console.log(err);
        })
    },
    async sortList(store, res) {
        await request({
            url: "/sortList",
            method: "GET",
            params: { res },
        }).then((res) => {
            store.commit('setData', res)
            return res
        })
    }
}
export default {
    namespaced: true,
    state,
    getters,
    mutations,
    actions
}